<template>
  <footer class="footer">
    <div class="footer-container">
      <div class="footer-content">
        <div class="footer-info">
          <h3 class="footer-title">课程学习平台</h3>
          <p class="footer-description">提供高质量的在线课程学习体验，帮助用户掌握各种技能</p>
        </div>
        
        <div class="footer-links">
          <h4>快速链接</h4>
          <ul>
            <li><a href="/" @click.prevent="goToHome">首页</a></li>
            <li v-if="isAuthenticated"><a href="/category" @click.prevent="goToCategory">课程分类</a></li>
            <li v-if="isAuthenticated"><a href="/add-course" @click.prevent="goToAddCourse">添加课程</a></li>
          </ul>
        </div>
        
        <div class="footer-contact">
          <h4>联系我们</h4>
          <p>邮箱：support@learning-platform.com</p>
          <p>电话：123-4567-8910</p>
        </div>
      </div>
      
      <div class="footer-bottom">
        <p>© 2024 课程学习平台. 保留所有权利.</p>
      </div>
    </div>
  </footer>
</template>

<script setup>
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { useUserStore } from '../stores'

const router = useRouter()
const userStore = useUserStore()

// 计算属性获取用户认证状态
const isAuthenticated = computed(() => userStore.isAuthenticated)

// 导航方法
const goToHome = () => {
  router.push('/')
}

const goToCategory = () => {
  router.push('/category')
}

const goToAddCourse = () => {
  router.push('/add-course')
}
</script>

<style scoped>
.footer {
  background-color: #303133;
  color: #fff;
  padding: 40px 0;
  margin-top: 60px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 30px;
}

.footer-info,
.footer-links,
.footer-contact {
  flex: 1;
  min-width: 200px;
  margin-bottom: 20px;
}

.footer-title {
  font-size: 24px;
  margin-bottom: 10px;
  color: #409EFF;
}

.footer-description {
  color: #c0c4cc;
  line-height: 1.6;
}

.footer-links h4,
.footer-contact h4 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #fff;
}

.footer-links ul {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: #c0c4cc;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: #409EFF;
}

.footer-contact p {
  color: #c0c4cc;
  margin-bottom: 10px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #4e4e4e;
  color: #909399;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
  }
  
  .footer-info,
  .footer-links,
  .footer-contact {
    margin-bottom: 30px;
  }
  
  .footer-title {
    font-size: 20px;
  }
  
  .footer-links h4,
  .footer-contact h4 {
    font-size: 16px;
  }
}
</style>